//
// Created by 高森森 on 2022/10/12.
//

#ifndef LEETCODE_SOLUTION_23_H
#define LEETCODE_SOLUTION_23_H
#include<bits/stdc++.h>
using namespace std;

class solution_23 {
public:
    vector<vector<int>> matrixReshape(vector<vector<int>>& mat, int r, int c) {
        vector<vector<int>>result(r,vector<int>(c,0));
        int row=mat.size();
        int col=mat[0].size();
        if((row*col)!=(r*c)){
            return mat;
        }
        for(int i=0;i<row*col;i++){
            result[i/c][i%c]=mat[i/col][i%col];
        }
        return result;
    }
};


#endif //LEETCODE_SOLUTION_23_H
